//package com.ruoyi.onlinevideo.receiver;/**
// * @InterfaceName: OrderReceiver
// * @Description:
// * @Author: YourName
// * @Date: 2023-04-19
// */
//
//import com.rabbitmq.client.Channel;
//import com.ruoyi.common.security.utils.SecurityUtils;
//import com.ruoyi.onlinevideo.handler.MyWebSocketHandler;
//import com.ruoyi.common.core.utils.MyMesssage;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.core.Queue;
//import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//
///**
// *@InterfaceName: OrderReceiver
// *@Description:
// *@Author: lilirui
// *@Date: 2023-04-19
// */
//@Component
//@Slf4j
//@ConditionalOnProperty(name="websocket.enabled",havingValue = "true")
//public class OrderReceiver implements ChannelAwareMessageListener {
//    @Bean
//    public Queue fanoutQueue1(){
//        return new Queue("mq.q1");
//    }
//    @Autowired
//    MyWebSocketHandler myWebSocketHandler;
//
//    @Override
//    public void onMessage(Message message, Channel channel) throws Exception {
//        byte[] body = message.getBody();
//        log.info("接收到消息:" + new String(body));
//        try {
//            MyMesssage myMesssage = new MyMesssage();
//            myMesssage.setUid(String.valueOf(SecurityUtils.getUserId()));
//            myMesssage.setMsg(new String(body));
//            myWebSocketHandler.systemMsg(myMesssage);
//        } catch (IOException e) {
//            log.error("send rabbitmq message error", e);
//        }
//    }
//}